<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head lang="en" th:replace="include/common/common :: commonHeader">
    <footer th:include="include/common/common :: layUiResource"></footer>
    <footer th:include="include/common/common :: blueCSSResource"></footer>

    <script>

        layui.config({
            base: '/staticResource/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index' , 'laytpl'] , function () {
            var admin = layui.admin
                ,element = layui.element
                ,form = layui.form;

            element.render();

            let entityName = 'user';
            $(document).ready(function () {
                $.fn.blueJs.tools.formButtonItem(entityName , 'user:edit');
            });

            form.on('submit(userSave)',function () {
                let msg = $.fn.blueJs.tools.formSubmit(this)
                    ,type = 'saveMsg';
                //当你在iframe页面关闭自身时
                let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                $.fn.blueJs.tools.active[type].call(this , msg , index);
                return false;
            });

            //点击事件监听
            $(document).on('click' , function (event) {
                let targetId = event.target.id;
                let cancelBtn = entityName + "CancelBtn";
                if (targetId == cancelBtn){
                    let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
            });
        });
    </script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form" id="userForm" th:object="${user}" method="post" action="/a/user/save">
                        <div class="blue-form-unit">基本信息</div>
                        <input type="hidden" name="id" id="userId" th:field="*{id}"/>
                        <input type="hidden" name="isNewRecord" th:field="*{isNewRecord}"/>

                        <div class="layui-form-item">
                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required ">*</span>登录名：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" id="loginCode" th:field="*{loginCode}" lay-verify="required" placeholder="请输入用户登录名" >
                                </div>
                            </div>

                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required ">*</span>用户名称：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" id="userName" th:field="*{userName}" lay-verify="required" placeholder="请输入用户名称" >
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required hide">*</span>手机号码：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" id="mobile" th:field="*{mobile}">
                                    <span class="blue-required mobile" ></span>
                                </div>
                            </div>

                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required hide">*</span>邮箱地址：</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" id="email" th:field="*{email}">
                                    <span class="blue-required email" ></span>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-col-md6">
                                <label class="layui-form-label " title=""><span class="blue-required ">*</span>用户类型：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="mgrType" th:field="*{mgrType}" value="0" title="普通员工">
                                    <input type="radio" name="mgrType" th:field="*{mgrType}" value="1" title="系统管理员">
                                    <input type="radio" name="mgrType" th:field="*{mgrType}" value="2" title="二级管理员">
                                    <span class="blue-required mgrType" ></span>
                                </div>
                            </div>

                        </div>



                        <div class="layui-form-item layui-layout-admin">
                            <div class="layui-input-block blue-form-button-item">
  <!--                              <div class="layui-footer" style="left: 0;">
                                    <button type="button" class="layui-btn" shiro:hasPermission="user:edit" lay-submit lay-filter="userSave" onsubmit="return false" id="userSaveBtn" blue-form-id="userForm">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                    <button type="button" class="layui-btn layui-btn-primary" onsubmit="return false" id="userCancelBtn">关闭</button>
                                </div>-->
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

    </div>
</div>
</body>
</html>